package org.pulloid;

import java.io.IOException;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

public class AttributeContext<T> extends NodeContext<T> {

	AttributeContext(ElementContext<T> parent, String name) {
		super(parent, name);
	}

	@Override
	void hydrate(XmlPullParser p, Reflector<T> record) throws XmlPullParserException, IOException {
		record.set(setter, p.getAttributeValue(null, name), transformer);
		if(nextSibling != null)
			nextSibling.hydrate(p, record);
	}

}
